package com.hengpeng.itfints.pagination.impl;

import com.hengpeng.itfints.pagination.Page;

/**
 * <pre>
 * 分页基础类
 * </pre>
 * @author chenjian
 * @version 1.0, 2013-8-21
 */
public class PageImpl implements Page
{
	private int currentPage;

	private int pageSize;

	public PageImpl(int currentPage, int pageSize)
	{
		setCurrentPage(currentPage);
		setPageSize(pageSize);
	}

	public int getCurrentPage()
	{
		return currentPage;
	}

	public void setCurrentPage(int currentPage)
	{
		this.currentPage = currentPage;
	}

	public int getPageSize()
	{
		return pageSize;
	}

	public void setPageSize(int pageSize)
	{
		this.pageSize = pageSize;
	}

	@Override
	public int getFirstPageIndex()
	{
		return (currentPage - 1) * pageSize;
	}

	@Override
	public int getMaxPageIndex()
	{
		return currentPage * pageSize;
	}
}
